package com.xiangge.zuoye.Demo1;

/**
 * @author xiyu
 * @version 1.0
 * @date 2025/3/17 17:48
 * @description 这是书籍的测试类
 */
public class BookTest {
    public static void main(String[] args) {

        Book[] books = new Book[5];
        books[0] = new Book(1,"三国1","罗贯中",56,51,75,"static/img/default.jpg");
        books[1] = new Book(2,"三国2","罗贯中",115,58,82,"static/img/default.jpg");
        books[2] = new Book(3,"三国3","罗贯中",42,52,44,"static/img/default.jpg");
        books[3] = new Book(4,"三国4","罗贯中",48,54,25,"static/img/default.jpg");
        books[4] = new Book(5,"三国5","罗贯中",74,55,72,"static/img/default.jpg");


        for (int i = 0; i < books.length; i++) {
            for (int j = 0; j < books.length-1; j++) {
                if (books[i].getSalse()>books[j].getSalse()){
                    Book temp = books[i];
                    books[i] = books[j];
                    books[j] = temp;
                }
            }
        }
        System.out.println("--------------");
        for (Book book : books) {
            System.out.println(book);
        }
    }
}
